home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Lists / List.h < prev    next >
Encoding:
Text File  |  1997-06-28  |  924 b   |  49 lines  |  [TEXT/CWIE]

  1. // List.h
  2.  
  3. #ifndef List_h
  4. #define List_h
  5.  
  6. #ifndef Sequence_h
  7. #include "Sequence.h"
  8. #endif
  9.  
  10. class ListNode;
  11. template <class Head, class Node> class SequenceLoop;
  12.  
  13. class List: public Sequence<List,ListNode>
  14.   {
  15.     public:
  16.         typedef ListNode Node;
  17.         typedef SequenceLoop<List,ListNode> Loop;
  18.         
  19.     private:
  20.         Node *first;
  21.         Node *last;
  22.         
  23.     public:
  24.         List();
  25.         ~List();
  26.         
  27.         const Node *First() const        { return first; }
  28.         const Node *Last() const        { return last; }
  29.         
  30.         Node *First()                        { return first; }
  31.         Node *Last()                        { return last; }
  32.         
  33.         bool IsEmpty() const                { return first == 0; }
  34.         
  35.         void Add( Node&, BeforeStart );
  36.         void Add( Node&, AfterEnd );
  37.         
  38.         void Add( Node&, Before, const Node& position );
  39.         void Add( Node&, After, const Node& position );
  40.         
  41.         void Add( Node&, Before, const Loop& position );
  42.         void Add( Node&, After, const Loop& position );
  43.         
  44.         void Remove( Node& );
  45.         void RemoveAll();
  46.   };
  47.  
  48. #endif
  49.